Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optionally filter email addresses #247

Merged
merged 7 commits into from
Apr 11, 2016
Merged

Optionally filter email addresses #247

merged 7 commits into from
Apr 11, 2016

Conversation

oreoshake
Copy link
Contributor

It is common for email replies with quoted content to include email addresses in banners from quoted text. These email addresses may have been marked as private and by commenting via email, their email address is exposed. e.g.

Before

This is the content of a reply immediately following a comment by me.

> On Thu, Aug 13, 2015, 6:18 PM Boaty McBoatface [email protected] wrote:
> 
> A previous comment of mine

>> On Thu, Aug 13, 2015, 2:30 PM Steve [email protected] wrote:
>>
>> An even older comment

After

This adds a flag to the EmailReplyFilter that will gsub out things that look somewhat like email addresses (erring on the false positive side).

Before

This is the content of a reply immediately following a comment by me.

> On Thu, Aug 13, 2015, 6:18 PM Boaty McBoatface ***@***.*** wrote:
> 
> A previous comment of mine

>> On Thu, Aug 13, 2015, 2:30 PM Steve  ***@***.*** wrote:
>>
>> An even older comment

/cc @jch sorry I guess I forgot to hit submit before heading out for the weekend, tab was still open 😄

@jch
Copy link
Contributor

jch commented Apr 11, 2016

Thanks for making this backwards compatible.

@jch jch merged commit bd7af4a into gjtorikian:master Apr 11, 2016
@@ -45,6 +47,11 @@ def call
paragraphs = EmailReplyParser.read(text.dup).fragments.map do |fragment|
pieces = [escape_html(fragment.to_s.strip).gsub(/^\s*(>|>)/, '')]
if fragment.quoted?
if context[:hide_quoted_email_addresses]
pieces.map! do |piece|
piece.gsub!(EMAIL_REGEX, HIDDEN_EMAIL_PATTERN)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bug 😢 gsub! can return nil.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants